home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_asm
/
assign
/
assign.dsm
< prev
next >
Wrap
Text File
|
1992-08-06
|
18KB
|
642 lines
; Disassembly of file :C:\ASSIGN.COM
;
; Define common ASCII control codes.
;
HT EQU 9
LF EQU 10
FF EQU 12
CR EQU 13
EOF EQU 26
;
; Define MSDOS/PCDOS functions.
;
_OUTSTR EQU 9
_SELDISK EQU 14
_GETDISK EQU 25
_GETVER EQU 48
_EXIT EQU 76
;
; Macro to generate MSDOS/PCDOS calls.
;
MSDOS MACRO name
IFDEF &name
MOV AH,&name
ENDIF
INT 21H
ENDM
;
;
;
Code_Seg SEGMENT PUBLIC
;
ASSUME CS:Code_Seg,DS:Code_Seg
ORG 02CH
ENV_SEG DW ?
ORG 080H
TAIL_LEN DW ?
;
ORG 00100H
L0100H: JMP L056DH
L0103H: DB 1,2,3,4,5,6
DB 7,8,9,0AH,0BH,0CH
DB 0DH,0EH,0FH,10H,11H,12H
DB 13H,14H,15H,16H,17H,18H
DB 19H,1AH
L011DH: DB 0
L011EH: DB 0
L011FH: DB 0,0
L0121H: DB 0
L0122H: DW 0
L0124H: DW 0
L0126H: DW 0
L0128H: DW 0
L012AH: DW 0
L012CH: DW 0
L012EH: DW 0
L0130H: DW 0
L0132H: DW 0
L0134H: DW 0
L0136H: DW 0
L0138H: DB 0
;
; JUMP TABLE
;
L0139H:
DW 0236H,0239H,0239H ;0,1,2
DW 0239H,0239H,0239H ;3
DW 0239H,0239H,0239H ;6
DW 0239H,0239H,0239H ;9
DW 0239H,0236H,047EH ;CH,DH,EH
DW 0240H,0240H,0240H ;FH,10H,11H
DW 0240H,0240H,0240H ;
DW 0240H,0240H,0240H
DW 0236H,046DH,0236H
DW 0236H,02EBH,0236H
DW 0236H,0236H,0236H
DW 0240H,0240H,0240H
DW 0240H,0236H,0236H
DW 0240H,0240H,0236H
DW 0236H,0236H,0236H
DW 0236H,0236H,0236H
DW 0236H,0236H,02EBH
DW 0236H,0236H,0236H
DW 02EBH,0236H,0236H
DW 029BH,029BH,029BH
DW 029BH,029BH,0236H
DW 0236H,0236H,029BH
DW 0236H,029BH,0340H
DW 0236H,0236H,02EBH
DW 0236H,0236H,0236H
DW 0398H,0236H,0236H
DW 029BH,0236H,0236H
DW 0236H,0236H,0236H
DW 0236H,0236H,0405H
DW 0236H,0236H,0236H
DW 029BH,029BH,0236H
DW 0236H,0236H,0236H
DW 03B5H,0236H,0236H ;5EH,5FH,60H
DW 0236H ;61H
;
; INTERRUPT 21H HERE .....
;
L0201H: MOV WORD PTR CS:[L0136H],0200H
PUSH AX
PUSH BX
CMP AH,63H
JA L0239H
MOV AL,AH
CBW ;Convert byte (AL) to word (AX).
SHL AX,1
MOV BX,AX
JMP WORD PTR CS:[BX]+0139H
;
L021BH: CALL L022EH
PUSH AX
MOV AX,8008H
INT 2AH
POP AX
RET
;
L0226H: PUSH AX
MOV AX,8108H
INT 2AH
POP AX
RET
;
L022EH: PUSH AX
MOV AX,8908H
INT 2AH
POP AX
RET
L0236H:
CALL L022EH
L0239H:
POP BX
POP AX
JMP CS:DWORD PTR [L0122H]
L0240H:
MOV BX,DX
MOV AL,BYTE PTR [BX]
CMP AL,0FFH
JNZ L024DH
ADD BX,7
MOV AL,BYTE PTR [BX]
L024DH: OR AL,AL
JNZ L0255H
MOV AL,BYTE PTR CS:[L011DH]
L0255H: CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
CALL L04ECH
MOV BYTE PTR [BX],AL
MOV WORD PTR CS:[L011FH],BX
POP BX
POP AX
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
PUSH AX
PUSH BX
MOV BX,WORD PTR CS:[L011FH]
MOV AL,BYTE PTR CS:[L011EH]
MOV BYTE PTR [BX],AL
POP BX
POP AX
PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
L029BH:
MOV BX,DX
CMP BYTE PTR [BX]+1,':'
JNZ L0239H
MOV AL,BYTE PTR [BX]
CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
CALL L050EH
MOV BYTE PTR [BX],AL
MOV WORD PTR CS:[L011FH],BX
POP BX
POP AX
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
PUSH AX
PUSH BX
MOV BX,WORD PTR CS:[L011FH]
MOV AL,BYTE PTR CS:[L011EH]
MOV BYTE PTR [BX],AL
POP BX
POP AX
PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
L02EBH:
OR DL,DL
JZ L033DH
MOV AL,DL
CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
CALL L04ECH
MOV DL,AL
POP BX
POP AX
MOV BYTE PTR CS:[L0138H],AH
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
CMP BYTE PTR CS:[L0138H],'6'
JZ L032FH
CMP BYTE PTR CS:[L0138H],1CH
JZ L032FH
MOV DL,BYTE PTR CS:[L011EH]
L032FH: PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
L033DH: JMP L0239H
POP BX
POP AX
PUSH AX
PUSH BX
CMP AX,4404H
JZ L0358H
CMP AX,4405H
JZ L0358H
CMP AX,4408H
JZ L0358H
CMP AX,4409H
JNZ L0395H
L0358H: OR BX,BX
JZ L0395H
MOV AL,BL
CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
CALL L04ECH
MOV BL,AL
POP AX
POP AX
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
MOV BL,BYTE PTR CS:[L011EH]
PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
L0395H: JMP L0239H
POP BX
POP AX
PUSH AX
PUSH BX
OR AL,AL
JNZ L03B2H
MOV BX,DX
CMP BYTE PTR [BX]+1,':'
JNZ L03AFH
MOV AL,BYTE PTR [BX]
CALL L050EH
MOV BYTE PTR [BX],AL
L03AFH: JMP L0239H
L03B2H: JMP L029BH
L03B5H:
MOV BX,SI
CMP BYTE PTR [BX]+1,':'
JNZ L03AFH
MOV AL,BYTE PTR [BX]
CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
CALL L050EH
MOV BYTE PTR [BX],AL
MOV WORD PTR CS:[L011FH],BX
POP BX
POP AX
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
PUSH AX
PUSH BX
MOV BX,WORD PTR CS:[L011FH]
MOV AL,BYTE PTR CS:[L011EH]
MOV BYTE PTR [BX],AL
POP BX
POP AX
PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
L0405H:
MOV BX,DX
MOV AX,WORD PTR [BX]
CALL L021BH
MOV BYTE PTR CS:[L011EH],AL
MOV WORD PTR CS:[L011FH],BX
CMP AH,':'
JNZ L041FH
CALL L050EH
MOV BYTE PTR [BX],AL
L041FH: MOV AX,WORD PTR ES:[DI]
MOV BYTE PTR CS:[L0121H],AL
CMP AH,':'
JNZ L0431H
CALL L050EH
MOV BYTE PTR ES:[DI],AL
L0431H: POP BX
POP AX
POP WORD PTR CS:[L0132H]
POP WORD PTR CS:[L0134H]
CALL L04C0H
CALL CS:DWORD PTR [L0122H]
PUSHF ;Push flag register.
CALL L04D4H
PUSH AX
PUSH BX
MOV AL,BYTE PTR CS:[L0121H]
MOV BYTE PTR ES:[DI],AL
MOV BX,WORD PTR CS:[L011FH]
MOV AL,BYTE PTR CS:[L011EH]
MOV BYTE PTR [BX],AL
POP BX
POP AX
PUSH WORD PTR CS:[L0134H]
PUSH WORD PTR CS:[L0132H]
CALL L0226H
IRET ;Return from interupt.
CALL L054DH
JZ L047BH
POP BX
POP AX
MOV AL,BYTE PTR CS:[L011DH]
DEC AL
IRET ;Return from interupt.
L047BH: JMP L0239H
L047EH:
POP BX
POP AX
MOV AL,DL
INC AL
CALL L021BH ; DO INT 2AH
MOV BYTE PTR CS:[L011EH],AL
CALL L04ECH
DEC AL
MOV DL,AL
MOV BYTE PTR CS:[L0121H],AL
PUSHF ;Push flag register.
CALL CS:DWORD PTR [L0122H]
PUSH AX
MOV AH,19H
PUSHF ;Push flag register.
CALL CS:DWORD PTR [L0122H]
MOV DL,BYTE PTR CS:[L011EH]
DEC DL
CMP AL,BYTE PTR CS:[L0121H]
JNZ L04BBH
MOV AL,BYTE PTR CS:[L011EH]
MOV BYTE PTR CS:[L011DH],AL
L04BBH: POP AX
CALL L0226H
IRET ;Return from interupt.
;
L04C0H: PUSH AX
PUSH BP
MOV BP,SP
MOV AX,WORD PTR [BP]+6
AND WORD PTR CS:[L0136H],AX
AND WORD PTR [BP]+6,0FDFFH
POP BP
POP AX
RET
;
L04D4H: PUSH AX
PUSH BP
MOV BP,SP
MOV AX,WORD PTR CS:[L0136H]
OR WORD PTR [BP]+6,AX
POP BP
POP AX
RET
;
L04E2H: INC AL
JZ L04E9H
CALL L04ECH
L04E9H: DEC AL
RET
;
L04ECH: CMP AL,1AH
JA L050DH
CMP AL,0
JNZ L04FCH
MOV AL,BYTE PTR CS:[L011DH]
MOV BYTE PTR CS:[L011EH],AL
L04FCH: PUSH BX
PUSH CX
MOV CH,AH
CBW ;Convert byte (AL) to word (AX).
MOV BX,0102H
ADD BX,AX
MOV AL,BYTE PTR CS:[BX]
MOV AH,CH
POP CX
POP BX
L050DH: RET
;
L050EH: CMP AL,'A'
JC L0527H
CMP AL,'Z'
JBE L051EH
CMP AL,'a'
JC L0527H
CMP AL,'z'
JA L0527H
L051EH: OR AL,20H
SUB AL,60H
CALL L04ECH
ADD AL,40H
L0527H: RET
;
; INTERRUPT 25H
;
L0528H: CALL L04E2H
JMP CS:DWORD PTR [L0126H]
;
; INTERRUPT 26H
;
L0530H: CALL L04E2H
JMP CS:DWORD PTR [L012AH]
;
; INTERRUPT 2FH
;
L0538H: CMP AH,6
JZ L0542H
JMP CS:DWORD PTR [L012EH]
L0542H: CMP AL,1
JC L054AH
JNZ L054CH
PUSH CS
POP ES
L054AH: MOV AL,0FFH
L054CH: IRET ;Return from interupt.
;
;
;
L054DH: PUSH SI
PUSH AX
PUSH CX
XOR AX,AX
MOV SI,AX
MOV CX,001AH
L0557H: MOV AL,BYTE PTR CS:[SI]+0103H
INC SI
CMP AX,SI
JNZ L0565H
LOOP L0557H ;Dec CX, loop if CX<>0.
XOR AX,AX
L0565H: POP CX
POP AX
POP SI
RET
L0569H: DW 0000H
L056BH: DW 0000H
;
; INIT PROGRAMM
;
L056DH:
MSDOS _GETVER ;Get DOS version number.
CMP AX,1F03H
JZ L0581H
MOV DX,OFFSET L06E2H
MSDOS _OUTSTR ;Display string at (DS:DX).
MSDOS _EXIT ;Terminate a process.
L0581H: MOV AX,WORD PTR ENV_SEG
OR AX,AX
JZ L0590H
PUSH ES
MOV ES,AX
MOV AH,49H
MSDOS ;Free allocated memory.
POP ES
L0590H: MOV AH,52H
MSDOS
MOV WORD PTR [L0569H],BX
MOV WORD PTR [L056BH],ES
PUSH DS
POP ES
CLD ;Set forward direction flag.
MOV SI,offset tail_len
LODSB ;Load AL with byt at (SI)+-.
OR AL,AL
JZ L05D8H
L05A7H: LODSB ;Load AL with byt at (SI)+-.
CMP AL,CR
JZ L05D8H
CALL L0671H
JZ L05A7H
CALL L068CH
CBW ;Convert byte (AL) to word (AX).
MOV BX,0102H
ADD BX,AX
LODSB ;Load AL with byt at (SI)+-.
CMP AL,CR
JZ L05C4H
CALL L0671H
JZ L05C7H
L05C4H: JMP L06BAH
L05C7H: LODSB ;Load AL with byt at (SI)+-.
CMP AL,CR
JZ L05C4H
CALL L0671H
JZ L05C7H
CALL L068CH
MOV BYTE PTR [BX],AL
JMP L05A7H
L05D8H: MOV AX,3525H ;Get interupt vector.
MSDOS
MOV WORD PTR [L0126H],BX
MOV WORD PTR [L0128H],ES
MOV AX,3526H ;Get interupt vector.
MSDOS
MOV WORD PTR [L012AH],BX
MOV WORD PTR [L012CH],ES
MOV AX,352FH ;Get interupt vector.
MSDOS
MOV WORD PTR [L012EH],BX
MOV WORD PTR [L0130H],ES
MOV AX,3521H ;Get interupt vector.
MSDOS
MOV WORD PTR [L0122H],BX
MOV WORD PTR [L0124H],ES
MOV AX,0600H
INT 2FH
OR AL,AL
JZ L0636H
MOV AH,19H
MSDOS ;Get current disk into (AL).
PUSH AX
MOV AX,0601H
INT 2FH
MOV SI,OFFSET L0103H
MOV DI,SI
MOV CX,001AH
CLI ;Disable interupts.
REPZ MOVSB ;Move byt, (SI)+- to (DI)+-.
STI ;Enable interupts.
POP DX
MOV AH,0EH
MSDOS ;Select disk in (AL).
L0630H: MOV AH,4CH
MSDOS ;Terminate a process.
JMP L0630H
L0636H: MOV AH,19H
MSDOS ;Get current disk into (AL).
INC AL
MOV BYTE PTR [L011DH],AL
CALL L04ECH
DEC AL
MOV DL,AL
MSDOS _SELDISK ;Select disk in (AL).
MOV DX,OFFSET L0528H
MOV AX,2525H ;Set int vector (AL) to DS:DX
MSDOS
MOV DX,OFFSET L0530H
MOV AX,2526H ;Set int vector (AL) to DS:DX
MSDOS
MOV DX,OFFSET L0538H
MOV AX,252FH ;Set int vector (AL) to DS:DX
MSDOS
MOV DX,OFFSET L0201H
MOV AX,2521H ;Set int vector (AL) to DS:DX
MSDOS
MOV DX,0057H
MOV AH,31H
MSDOS ;Terminate and stay resident.
;
L0671H: CMP AL,' '
JZ L068BH
CMP AL,LF
JZ L068BH
CMP AL,'+'
JZ L068BH
CMP AL,';'
JZ L068BH
CMP AL,HT
JZ L068BH
CMP AL,','
JZ L068BH
CMP AL,'='
L068BH: RET
;
L068CH: CALL L06C5H
SUB AL,41H
JC L06BAH
PUSH ES
PUSH BX
PUSH AX
LES BX,DWORD PTR [L0569H] ;Load ES:BX with 32b pointer.
CMP AL,BYTE PTR ES:[BX]+33
JNC L06BAH
LES BX,DWORD PTR ES:[BX]+22 ;Load ES:BX with 32b pointer.
PUSH BX
MOV BL,51H
MUL BL
POP BX
ADD BX,AX
TEST WORD PTR ES:[BX]+67,4000H
JZ L06BAH
POP AX
POP BX
POP ES
INC AL
RET
L06BAH: MOV DX,OFFSET L06D0H
MOV AH,9
MSDOS ;Display string at (DS:DX).
MOV AH,4CH
MSDOS ;Terminate a process.
;
L06C5H: CMP AL,'a'
L06C7H: JC L06CFH
CMP AL,'z'
JA L06CFH
SUB AL,20H
L06CFH: RET
L06D0H: DB 'Invalid parameter$'
L06E2H: DB 'Incorrect DOS version',CR,LF,'$'
Code_Seg ENDS
END L0100H